﻿@{
    ViewBag.Title = "页面列表";
    Layout = "~/Views/Shared/_Form.cshtml";
    string v = System.Configuration.ConfigurationManager.AppSettings["version"];

}

@section styles{
    <link href="~/Scripts/ztree/zTreeStyle/zTreeStyle.css?v=@v" rel="stylesheet"/>
}

@section scripts
{
    <script src="~/Scripts/ztree/jquery.ztree.all.min.js?v=@v"></script>
    <script src="~/Scripts/page/wike.ztree.js?v=@v"></script>
    <script type="text/javascript">
        function beforeClick(treeId, treeNode) {
            $("#txtParentId").val(treeNode.id);
        }
        var config = {
            id: 'pageTree',
            loadUrl: '@Url.Action("GetTrees")',
            addUrl: '@Url.Action("Add")',
            editUrl: '@Url.Action("Edit")',
            deleteUrl: '@Url.Action("Delete")',
            beforeClick: beforeClick
        };
        var pageTree = new WikeTree(config);
        pageTree.load();
        $("#btnCancel").click(function () {
            var zTree = $.fn.zTree.getZTreeObj(config.id);
            zTree.cancelSelectedNode();
            $("#txtParentId").val("");
        });
    </script>
}

<div class="">
    <button class="btn btn-default" id="btnAdd">
        <i class="fa fa-plus"></i> 添加
    </button>
    <button class="btn btn-default" id="btnEdit">
        <i class="fa fa-reorder"></i> 编辑
    </button>
    <button class="btn btn-default" id="btnDelete">
        <i class="fa fa-remove"></i> 删除
    </button>
    
</div>
<input id="txtParentId" type="hidden"/>
<ul id="pageTree" class="ztree">
    <li>页面加载中......</li>
</ul>